﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using ZLDC.Common.Estate;
using ZLDC.Topo.Model.Estate;

namespace ZLDC.Estate.CM
{
    public partial class HousingDetails : _PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) 
            {
                int id = _Request.GetInt("id", 0);
                DataTable dt = null;
                int total = 0;
                string condition = " where type='房屋设施'";

                using (_Database db = new _Database("estate"))
                {
                    dt = ZLDC.DAL.Estate.SystemParamDAL.p_system_param_list_table(1, 50, condition, ref total, db);
                }
                string strList = "";
                HousingInfo info = ZLDC.Topo.BLL.Estate.HousingBLL.p_housing_detail(id);
                if (info!=null)
                {
                  
                    string[] hList;
                    string happliances = info.HAppliances;
                    if (happliances.Length > 0)
                    {
                        hList = happliances.Split(',');

                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (hList[i] == "0")
                            {
                                strList += dt.Rows[i]["item"].ToString() + ",";
                            }
                        }
                        if (strList != "")
                        {
                            spanHappliances.InnerText = strList.Substring(0, strList.Length - 1);
                        }
                    }
                }
            }
        }
    }
}
